package com.atguigu.algorithm;

public class Multi {
    public static void main(String[] args) {
        System.out.println(multi(3, 5));
    }
    public static int multi(int a,int b){
        int res=0;
        while(b!=0) {
            if ((b & 1) == 1) {
                res = add(res, a);
            }
            a <<= 1;
            b >>>= 1;
        }
        return res;
    }
    public static int add(int a,int b){
        int sum=a;
        while(b!=0){
            sum=a^b;
            b=(a&b)<<1;
            a=sum;
        }
        return sum;
    }
}
